package edu.ynu.se.xiecheng.achitectureclass.dao;

import edu.ynu.se.xiecheng.achitectureclass.entity.SoilPotassiumData;
import edu.ynu.se.xiecheng.achitectureclass.entity.Device;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Optional;

@Repository
public interface SoilPotassiumRepository extends JpaRepository<SoilPotassiumData, Long> {
    Optional<SoilPotassiumData> findFirstByOrderByCreateTimeDesc();
    List<SoilPotassiumData> findByCreateTimeBetween(LocalDateTime start, LocalDateTime end);
    List<SoilPotassiumData> findByDeviceAndCreateTimeBetween(Device device, LocalDateTime start, LocalDateTime end);
} 